<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../plugins/vue.min.js"></script>
</head>
<body>
    <div id="box">
        <ul>
            <!-- input事件和change事件的区别 -->
            <!-- @input   @change -->
            <input type="text" @input="checkValues" v-model="myValue">
            <li v-for="(item,index) of dataArr" :key="index">
                {{item}}
            </li>
        </ul>
    </div>
    <script>
        let vm = new Vue({
            el:"#box",
            data:{
                myValue:'',
                dataArr:['11','22','33','44'] ,
                oldArr:['11','22','33','44'] 
            },
            methods: {
                checkValues(){
                    // 利用es5中的filter方法
                //    this.dataArr = ['11','22','33','44']
                   let newArr = this.oldArr.filter(item=>item.includes(this.myValue))
                   this.dataArr = newArr;
                   console.log(this.myValue)
                }
            },
        })
    </script>
</body>
</html>